﻿@model MvcTestApp.Models.RegisterModel

@{
    ViewBag.Title = "Register";
}

<h2>Create a New Account</h2>
<p>
    Use the form below to create a new account. 
</p>
<p>
    Passwords are required to be a minimum of @Membership.MinRequiredPasswordLength characters in length.
</p>

<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@*Custom Client Side Validation Code Starts here*@
@*This JavaScript Validation code Must be out side of the $(document).ready function. Otherwise it will not work.*@
<script language="javascript" type="text/javascript">
    jQuery.validator.addMethod("tutulvalidation", function (value, element, param) {
        //alert('asdfsadfsadf');
        if (value.indexOf('Tutul') >= 0)
            return true;

        return false;
    });
    jQuery.validator.unobtrusive.adapters.addBool("tutulvalidation");    
</script>
@*Custom Client Side Validation Code Ends Here*@

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true, "Account creation was unsuccessful. Please correct the errors and try again.")
    <div>
        <fieldset>
            <legend>Account Information</legend>

            <div class="editor-label">
                @Html.LabelFor(m => m.UserName)
            </div>
            <div class="editor-field">
                @*@Html.TextBoxFor(m => m.UserName)
                @Html.ValidationMessageFor(m => m.UserName)*@

                <input data-val="true" data-val-tutulvalidation="Please Enter a Valid User Name Containing Tutul" 
                    data-val-required="The UserName field is required." id="UserName" name="UserName" type="text" value="" />
                <span class="field-validation-valid" data-valmsg-for="UserName" data-valmsg-replace="true"></span>
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Email)
            </div>
            <div class="editor-field">
                @Html.TextBoxFor(m => m.Email)
                @Html.ValidationMessageFor(m => m.Email)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.Password)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.Password)
                @Html.ValidationMessageFor(m => m.Password)
            </div>

            <div class="editor-label">
                @Html.LabelFor(m => m.ConfirmPassword)
            </div>
            <div class="editor-field">
                @Html.PasswordFor(m => m.ConfirmPassword)
                @Html.ValidationMessageFor(m => m.ConfirmPassword)
            </div>

            <p>
                <input type="submit" value="Register" />
            </p>

            @*Code To Show an YouTube Video*@
            @*<div>                
                @Microsoft.Web.Helpers.Video.Flash("http://www.youtube.com/v/U5GAG9kpAG8", width: "700", height: "500")                 
            </div>*@
            @*Code To Show an YouTube Video*@
        </fieldset>
    </div>
}
